package com.pan.games.play;

import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author by panstark
 * @description
 * @notice
 * @date 2021/3/7
 */
public class MaxHeap {

    Map map=new HashMap();
    Map c = new ConcurrentHashMap();
    static PriorityQueue<Integer> minHeap = new PriorityQueue(10);

    static PriorityQueue<Integer> maxHeap = new PriorityQueue<>(10, new Comparator<Integer>() {
        @Override
        public int compare(Integer o1, Integer o2) {
            return o2-o1;
        }
    });

    public static void main(String[] args) {

        for (int i = 0; i < 10; i++) {

            minHeap.add(i);
            maxHeap.add(i);
        }

        Integer minPoll = minHeap.poll();
        System.out.println("min:"+minPoll);

        Integer maxPoll = maxHeap.poll();
        System.out.println("max:"+maxPoll);

    }
}
